import request from '@/utils/request'

// 查询采购单列表
export function listPurchase(query) {
  return request({
    url: '/purchase/order/list',
    method: 'get',
    params: query
  })
}

// 查询采购单详细
export function getPurchase(id) {
  return request({
    url: '/purchase/order/' + id,
    method: 'get'
  })
}

// 新增采购单
export function addPurchase(data) {
  return request({
    url: '/purchase/order',
    method: 'post',
    data: data
  })
}

export function addAllPurchase(data) {
  return request({
    url: '/purchase/order/addAll',
    method: 'post',
    data: data
  })
}

export function addAllSubmit(data) {
  return request({
    url: '/purchase/order/addAllSubmit',
    method: 'post',
    data: data
  })
}

// 修改采购单
export function updatePurchase(data) {
  return request({
    url: '/purchase/order',
    method: 'put',
    data: data
  })
}
//提交采购单
export function submitPurchase(data) {
  return request({
    url: '/purchase/order/submit',
    method: 'put',
    data: data
  })
}
// 删除采购单
export function delPurchase(id) {
  return request({
    url: '/purchase/order/' + id,
    method: 'delete'
  })
}

// 采购单 转换成入库单
export function generaterItemrecpt(id) {
  return request({
    url: '/purchase/order/convert/' + id,
    method: 'put'
  })
}
